<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<title>广东国防教育学会</title>
		<meta name="viewport" content="initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css" />
		<link rel="stylesheet" href="http://idangero.us/swiper/dist/css/swiper.min.css" />
		<link rel="stylesheet" href="/Public/Home/activity/css/style.css" />
	</head>
	<body>

	<nav class="bar bar-tab">
			<a class="tab-item open-indicator <?php if($active == 'home'): ?>active<?php endif; ?>"  href="/">
				<span class="icon icon-home"></span>
				<span class="tab-label">首页</span>
			</a>
			<a class="tab-item open-indicator" href="<?php echo U('Apply/apply');?>">
				<span class="icon iconfont icon-category"></span>
				<span class="tab-label">专家预约</span>
			</a>
			<a class="tab-item open-indicator" <?php if($active == 'user_company'): ?>active<?php endif; ?>" href="<?php echo U('UserCompany/index');?>">
				<span class="icon iconfont icon-huiyuan1"></span>
				<span class="tab-label">会员单位</span>
			</a>
			<a class="tab-item open-indicator <?php if($active == 'user'): ?>active<?php endif; ?>" href="<?php echo U('Users/index');?>">
				<span class="icon iconfont icon-account"></span>
				<span class="tab-label">我的</span>
			</a>
		</nav>
<div class="bar bar-nav">
			<h1 class="title"><?php echo ($activity['activity_name']); ?></h1>
			<i class="icon icon-left" onclick="window.history.go(-1);"></i>
		</div>
		<div class="content">
		<form action="<?php echo U('Users/releaseActivity');?>" method="post" id="activity_form" class="sui-form form-horizontal" enctype="multipart/form-data">
			<div class="row activity_banner">
				<div class="col-100 publish_sc">
					<img id="img" src="/Public/Home/activity/img/banner_2.jpg" height="220px">
					<button class="button button-fill ">上传活动海报</button>
					<input type="file" name="activity_img" id="photo">
				</div>
			</div>

			<div class="row activity_list publish_list">
				<div class="col-100">
					<div class="list-block">
						
						<ul class="input-daterange">
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-discount"></i></div>
								<div class="item-inner">
									<div class="item-input"><input type="text" name="activity_name" placeholder="活动主题" ></div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-clock"></i></div>
								<div class="item-inner">
									<div class="item-input"><input type="text" name="start_time" class="input-medium-1 input-date" placeholder="活动开始时间"></div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-history"></i></div>
								<div class="item-inner">
									<div class="item-input"><input type="text" name="end_time" class="input-medium-2 input-date" placeholder="活动结束时间"></div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-zhubanfang"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input type="text" name="sponsor" placeholder="主办方" >
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-category"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<select name="category">
											<option value="">选择分类</option>
										  <?php if(is_array($category)): foreach($category as $k=>$v): ?><option value="<?php echo ($v['id']); ?>"><?php echo ($v['name']); ?></option><?php endforeach; endif; ?>
										</select>
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-map"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input class="input_map" name="address" type="text" placeholder="活动地点" >
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-map"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input type="text" name="detail_address" placeholder="详细地址" >
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-renshu"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input type="text" name="number" placeholder="人数限制" >
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-phone"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input type="text" name="contact_mobile" placeholder="联系方式" >
									</div>
								</div>
							</li>
							<li class="item-content">
								<div class="item-media"><i class="iconfont icon-demo22"></i></div>
								<div class="item-inner">
									<div class="item-input">
										<input type="text" name="price" placeholder="报名费用，免费请0" >
									</div>
								</div>
							</li>
							<!-- <li class="item-content">
								<div class="item-inner">
									<div class="item-input">
										<a href="<?php echo U('Users/show_page');?>"> 
											<textarea  rows="4" placeholder="活动简介"></textarea>
										</a>
										<input type="hidden" name="describe" value=""/>
										
									</div>
								</div>
							</li> -->
						</ul>
						<div class="publish_bottom">
								<label><input name="agree" type="checkbox">我同意《发布活动协议》</label>
								<button type="submit" style="width: 100%;margin-top: 1rem;" class="create-actions button-block button button-fill">下一步</button>
						</div>
						
					</div>
				</div>
			</div>
			</form>
</div>


		<script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
		<script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
		<script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
		<script src="http://idangero.us/swiper/dist/js/swiper.min.js"></script>
		<script type="text/javascript" src="/Public/Home/activity/js/huodon.js" ></script>
		<script>
			
			var swiper = new Swiper('.swiper-container', {
				pagination: '.swiper-pagination',
				paginationClickable: true,
				loop:true,    
				grabCursor: true,
				autoplay: 3000
			});
			
			 /* $(document).on('click','.open-preloader', function () {
				 Zepto.showPreloader('加载中...')
				    setTimeout(function () {
				    	 Zepto.hidePreloader();
				    }, 2000); 
			 }); */
			 $(document).on('click','.open-indicator', function () {
				 Zepto.showIndicator();
			     setTimeout(function () {
			    	Zepto.hideIndicator();
			     }, 2000);
			  });
		</script>
		

	</body>

</html>


<script type="text/javascript">
 $("#photo").change(function(){
      var objUrl = getObjectURL(this.files[0]);
      console.log("objUrl = "+objUrl);
      if (objUrl) {
          $("#img").attr("src", objUrl);
      }
  }) ;
 //建立一個可存取到該file的url
 function getObjectURL(file) {
     var url = null ;
     if (window.createObjectURL!=undefined) { // basic
         url = window.createObjectURL(file) ;
     } else if (window.URL!=undefined) { // mozilla(firefox)
         url = window.URL.createObjectURL(file) ;
     } else if (window.webkitURL!=undefined) { // webkit or chrome
         url = window.webkitURL.createObjectURL(file) ;
     }
     return url ;
 }
 
 $("#activity_form").submit(function(){
	 if($("input[name='activity_img']").val() == ''){
		 Zepto.toast('请上传活动海报！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='activity_name']").val() == ''){
		 Zepto.toast('请填写活动主题！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='start_time']").val() == ''){
		 Zepto.toast('请选择开始时间！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='end_time']").val() == ''){
		 Zepto.toast('请选择结束时间！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='sponsor']").val() == ''){
		 Zepto.toast('请填写主办方！', 2000, 'success top');
		 return false;
	 }
	 if($("select[name='category']").val() == ''){
		 Zepto.toast('请填写分类！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='address']").val() == ''){
		 Zepto.toast('请填写活动地点！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='detail_address']").val() == ''){
		 Zepto.toast('请填写详细地址！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='number']").val() == ''){
		 Zepto.toast('请填写人数限制！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='contact_mobile']").val() == ''){
		 Zepto.toast('请填写联系方式！', 2000, 'success top');
		 return false;
	 }
	 var myreg = /(1[3-9]\d{9})$/;
	 if(!myreg.test($("input[name='contact_mobile']").val())){
		 Zepto.toast('手机格式不对！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='price']").val() == ''){
		 Zepto.toast('请填写报名费用！', 2000, 'success top');
		 return false;
	 }
	 if($("input[name='agree']").is(':checked') == false){
		 Zepto.toast('请勾选协议！', 2000, 'success top');
		 return false;
	 }
	 
 });
</script>
		<!--城市选择结束-->
		<script type="text/javascript" src="http://g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js" charset="utf-8"></script>
		<script>
			Zepto(function(){
				Zepto(".input-medium-1").datetimePicker({
    			value: ['2017', '01', '01', '9',"00"],
  				});
  				Zepto(".input-medium-2").datetimePicker({
    			value: ['2017', '01', '01', '9',"00"],
  				});
  				Zepto(".input_map").cityPicker({
				    toolbarTemplate: '<header class="bar bar-nav">\
				    <button class="button button-link pull-right close-picker">确定</button>\
				    <h1 class="title">选择活动地点</h1>\
				    </header>'
				});
			})
		</script>